﻿//<div id="ControlID" class="custom-users">
//    <div id="dlgUsers" style="display:none;padding:10px;">
//        <div class="custom-users-query">
//部门:<input type="text" />
//    职位:<input type="text" />
//    姓名:<input type="text" />
//</div>
//<div class="custom-users-body">
//    <div id="gridUsers">
//    </div>
//</div>
//</div>
//</div>

customui = {};
customui.controls = {};

customui.UserPicker = function (id, e) {
    var je = $(e);
    customui.controls[id] = {
        dialog: null,
        grid: null,
        show: function (callback) {
            var obj = customui.controls[id];
            if (obj.dialog) {
                obj.dialog.show();
            } else {
            }
        }
    };

    je.append($(
        '<div id="dlg' + id + '" style="display:none;padding:10px;">' +
            '<div class="custom-userpicker-query">' +
                '部门:<input id="' + id + '_dept" type="text" />' +
                '职位:<input id="' + id + '_position" type="text" />' +
                '姓名:<input id="' + id + '_username" type="text" />' +
            '</div>' +
            '<div class="custom-userpicker-body">' +
               '<div id="grid' + id + '"></div>' +
            '</div>' +
        '</div>'));
}

customui._builder = [];
customui._builder["custom-userpicker"] = customui.UserPicker;

customui.get = function (id) {
    var _control = customui.controls[id];
    if (_control)
        return _control;

    var e = $('#' + id);
    if (e[0] &&
        customui._builder[ele[0].className]) {
        customui._builder[ele[0].className](id, e[0]);
    }
}

customui._init = function () {
    
}

$(function () {
    customui._init();
});